package gestionColis;

/**
 * Interface definition : GestTransporteur
 * 
 * @author OpenORB Compiler
 */
public abstract class GestTransporteurPOA extends org.omg.PortableServer.Servant
        implements GestTransporteurOperations, org.omg.CORBA.portable.InvokeHandler
{
    public GestTransporteur _this()
    {
        return GestTransporteurHelper.narrow(_this_object());
    }

    public GestTransporteur _this(org.omg.CORBA.ORB orb)
    {
        return GestTransporteurHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:gestionColis/GestTransporteur:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("consulterEtatColis")) {
                return _invoke_consulterEtatColis(_is, handler);
        } else if (opName.equals("enregistrerTransporteur")) {
                return _invoke_enregistrerTransporteur(_is, handler);
        } else if (opName.equals("majEtatColis")) {
                return _invoke_majEtatColis(_is, handler);
        } else if (opName.equals("mandaterTransporteur")) {
                return _invoke_mandaterTransporteur(_is, handler);
        } else if (opName.equals("validerTransporteur")) {
                return _invoke_validerTransporteur(_is, handler);
        } else if (opName.equals("verifieIdentiteTransporteur")) {
                return _invoke_verifieIdentiteTransporteur(_is, handler);
        } else if (opName.equals("verifieValiditeCodePresta")) {
                return _invoke_verifieValiditeCodePresta(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke_enregistrerTransporteur(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionColis.Transporteur arg0_in = gestionColis.TransporteurHelper.read(_is);

        enregistrerTransporteur(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_verifieIdentiteTransporteur(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionColis.InfoColis arg0_in = gestionColis.InfoColisHelper.read(_is);

        try
        {
            verifieIdentiteTransporteur(arg0_in);

            _output = handler.createReply();

        }
        catch (gestionColis.IdTransporteurInvalideException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.IdTransporteurInvalideExceptionHelper.write(_output,_exception);
        }
        catch (gestionColis.NumColisInexistantException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.NumColisInexistantExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_majEtatColis(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionColis.InfoColis arg0_in = gestionColis.InfoColisHelper.read(_is);

        try
        {
            majEtatColis(arg0_in);

            _output = handler.createReply();

        }
        catch (gestionColis.IdTransporteurInvalideException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.IdTransporteurInvalideExceptionHelper.write(_output,_exception);
        }
        catch (gestionColis.NumColisInexistantException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.NumColisInexistantExceptionHelper.write(_output,_exception);
        }
        catch (gestionColis.EtatIncorrectException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.EtatIncorrectExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_consulterEtatColis(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionColis.InfoColis arg0_in = gestionColis.InfoColisHelper.read(_is);

        try
        {
            gestionColis.InfoColis _arg_result = consulterEtatColis(arg0_in);

            _output = handler.createReply();
            gestionColis.InfoColisHelper.write(_output,_arg_result);

        }
        catch (gestionColis.NumColisInexistantException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.NumColisInexistantExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_validerTransporteur(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionColis.InfoColis arg0_in = gestionColis.InfoColisHelper.read(_is);

        try
        {
            String _arg_result = validerTransporteur(arg0_in);

            _output = handler.createReply();
            _output.write_string(_arg_result);

        }
        catch (gestionColis.NumColisInexistantException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.NumColisInexistantExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_mandaterTransporteur(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionColis.InfoColis arg0_in = gestionColis.InfoColisHelper.read(_is);

        mandaterTransporteur(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_verifieValiditeCodePresta(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();
        String arg1_in = _is.read_string();

        try
        {
            boolean _arg_result = verifieValiditeCodePresta(arg0_in, arg1_in);

            _output = handler.createReply();
            _output.write_boolean(_arg_result);

        }
        catch (gestionColis.CodePrestationInvalideException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.CodePrestationInvalideExceptionHelper.write(_output,_exception);
        }
        catch (gestionColis.CodePrestationPerimeException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.CodePrestationPerimeExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

}
